package io.virtualapp.delegate;

import android.app.Activity;
import android.app.Application;
import android.content.Context;

import com.lody.virtual.helper.utils.VLog;
import com.scorpion.splash.AppComponentDelegate;

import io.virtualapp.delegate.hook.plugin.LocationHook;

/**
 * 用于hook应用
 */
public class MyComponentDelegate extends AppComponentDelegate {
    private static final String TAG = "MyComponentDelegate";

    Context mContext;

    public MyComponentDelegate(Context context) {
        super(context);
        this.mContext = context;
    }

    @Override
    public void beforeStartApplication(String packageName, String processName, Context context) {
        super.beforeStartApplication(packageName, processName, context);
    }

    @Override
    public void beforeApplicationCreate(String packageName, String processName, Application application) {
        super.beforeApplicationCreate(packageName, processName, application);
    }

    @Override
    public void afterApplicationCreate(String packageName, String processName, Application application) {
        //super.afterApplicationCreate(packageName, processName, application);
        if (packageName.equals("com.ss.android.lark")) {
            VLog.d("VA-", "开始 hook 飞书打卡");
            new LocationHook().hook(packageName, processName, application);
        }
        if (packageName.equals("com.alibaba.android.rimet")) {
            VLog.d("VA-", "开始 hook 钉钉打卡");
            new LocationHook().hook(packageName, processName, application);
        }
    }

}
